import passwordImage from "../../assets/image/loginPage-password.png"
import eyeOpenImage from "../../assets/image/loginPage-eye-open.png"
import evyCloseImage from "../../assets/image/loginPage-eye-close.png"
import { Form, Input } from "antd";

// 主页-表单子项密码框
interface formItemPasswordInputComponentComponentInterface {
  name: string
  specialRule?: Array<object>
  placeholder: string
}
const FormItemPasswordInputComponent: React.FC<formItemPasswordInputComponentComponentInterface> = (props) => {
  return (
    <Form.Item
      name={props.name}
      rules={[{ required: true, message: props.placeholder },...props.specialRule??[]]}
    >
      <Input.Password prefix={<img src={passwordImage} />} placeholder={props.placeholder} autoComplete="off" iconRender={(visible) => (visible ? <img src={eyeOpenImage} /> : <img src={evyCloseImage} />)} />
    </Form.Item>
  )
}

export default FormItemPasswordInputComponent